<?php
$host="localhost";
$db_user="root";
$db_pass="";
$db_name="canteen";

/*
微信配置参数
 */
$appid="wxc35313e543049b17";
$appsecret="7aa27c019e461215a8083340953cc49d";
$GLOBALS['appid']=$appid;
$GLOBALS['appsecret']=$appsecret;

/*
数据库连接
 */
// $link=mysqli_connect($host,$db_user,$db_pass,$db_name);
// $GLOBALS['link']=$link;
// mysqli_query($GLOBALS['link'],"SET names UTF8");

// header("Content-Type: text/html; charset=utf-8");

// if (!$GLOBALS['link']) {
//     die("Connection failed: " . mysqli_connect_error());
// }
    //连接mysql
    $link=@mysql_connect($host,$db_user,$db_pass) or die ('数据库连接失败<br/>ERROR '.mysql_errno().':'.mysql_error());
    //设置字符集
    $GLOBALS['link']=$link;
    mysql_set_charset("UTF8");
    //打开指定的数据库
    mysql_select_db($db_name)or die('指定的数据库打开失败');    
	header("Content-Type: text/html; charset=utf-8");

?>
